home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 46 / Mobiclic46.iso / pc / DATA / SHARED / COMMUNS.CST / 00005_Script_gestion des sprites < prev    next >
Text File  |  2002-07-12  |  5KB  |  193 lines

  1. -------------------------------------------------------------------
  2. ---------------------- PROCEDURES UTILITAIRES ---------------------
  3. -------------------------------------------------------------------
  4.  
  5. -- Variables globales
  6. global volumeOn -- indique si la fenΩtre de rΘglage du volume est active
  7. global sonEnCours -- contient le nom du dernier son jouΘ
  8. global traitLiaison
  9.  
  10. -- gestion des rollOver
  11. -- sur une image sans curseur perso
  12. on glisserSur piste1,piste2,ecart1,ecart2
  13.   if volumeOn<>1 then
  14.     case the paramCount of
  15.       1:-- un seul paramΦtre
  16.         set piste2 = piste1
  17.         set ecart1=0
  18.         set ecart2=0
  19.       2:-- deux paramΦtres
  20.         set ecart1=0
  21.         set ecart2=0
  22.       3:-- trois paramΦtres
  23.         set ecart2=ecart1
  24.     end case
  25.     
  26.     sprite(value(member("PPGS").text)).locH = the mouseH
  27.     sprite(value(member("PPGS").text)).locV = the mouseV
  28.     
  29.     repeat with i=piste1 to piste2
  30.       if rollOver(i) and sprite value(member("PPGS").text) intersects i then
  31.         afficherPistes i+ecart1, i+ecart2
  32.       else
  33.         masquerPistes i+ecart1, i+ecart2
  34.       end if
  35.     end repeat
  36.     -- les pistes de numΘro les plus ΘlevΘs sont prioritaires
  37.     repeat with i= piste2 down to 1+piste1
  38.       if the visible of sprite(i+ecart1) =1 then
  39.         repeat with j=piste1 to i-1
  40.           masquerPistes j+ecart1
  41.           if ecart2<>0 then
  42.             masquerPistes j+ecart2
  43.           end if
  44.         end repeat
  45.       end if
  46.     end repeat
  47.   end if
  48. end glisserSur
  49.  
  50. -- sur une image avec curseur doigt et dissimulation de la piste cible
  51. on glisserSurCM piste1,piste2,ecart1,ecart2
  52.   if volumeOn<>1 then
  53.     case the paramCount of
  54.       1:-- un seul paramΦtre
  55.         set piste2 = piste1
  56.         set ecart1=0
  57.         set ecart2=0
  58.       2:-- deux paramΦtres
  59.         set ecart1=0
  60.         set ecart2=0
  61.       3:-- trois paramΦtres
  62.         set ecart2=ecart1
  63.     end case
  64.     
  65.     sprite(value(member("PPGS").text)).locH = the mouseH
  66.     sprite(value(member("PPGS").text)).locV = the mouseV
  67.     
  68.     repeat with i=piste1 to piste2
  69.       if rollOver(i) and sprite value(member("PPGS").text) intersects i then
  70.         sprite(i+ecart1).cursor = 280
  71.         masquerPistes i
  72.         afficherPistes i+ecart1, i+ecart2
  73.       else
  74.         afficherPistes i
  75.         masquerPistes i+ecart1, i+ecart2
  76.       end if
  77.     end repeat
  78.   end if
  79. end glisserSurCM
  80.  
  81. -- sur une image avec curseur doigt sans dissmulation piste cible
  82. on glisserSurC piste1,piste2,ecart1,ecart2
  83.   if volumeOn<>1 then
  84.     case the paramCount of
  85.       1:-- un seul paramΦtre
  86.         set piste2 = piste1
  87.         set ecart1=0
  88.         set ecart2=0
  89.       2:-- deux paramΦtres
  90.         set ecart1=0
  91.         set ecart2=0
  92.       3:-- trois paramΦtres
  93.         set ecart2=ecart1
  94.     end case
  95.     
  96.     sprite(value(member("PPGS").text)).locH = the mouseH
  97.     sprite(value(member("PPGS").text)).locV = the mouseV
  98.     
  99.     repeat with i=piste1 to piste2
  100.       if rollOver(i) and sprite(value(member("PPGS").text)).intersects(i) then
  101.         sprite(i).cursor = 280
  102.         afficherPistes i+ecart1, i+ecart2
  103.       else
  104.         masquerPistes i+ecart1, i+ecart2
  105.       end if
  106.     end repeat
  107.     -- les pistes de numΘro les plus ΘlevΘs sont prioritaires
  108.     repeat with i= piste2 down to 1+piste1
  109.       if the visible of sprite(i+ecart1) =1 then
  110.         repeat with j=piste1 to i-1
  111.           set the visible of sprite(j+ecart1) to false
  112.           if ecart2<>0 then
  113.             set the visible of sprite(j+ecart2) to false
  114.           end if
  115.         end repeat
  116.       end if
  117.     end repeat
  118.   end if
  119. end glisserSurC
  120.  
  121. -- masquer des pistes
  122. on masquerPistes
  123.   repeat with i=1 to the paramCount
  124.     if value(param(i))<>0 then
  125.       set the visible of sprite(param(i)) to false
  126.     else
  127.       listePistes1 param(i),0
  128.     end if
  129.   end repeat
  130. end masquerPistes
  131.  
  132. -- afficher des pistes
  133. on afficherPistes
  134.   repeat with i=1 to the paramCount
  135.     if value(param(i))<>0 then
  136.       set the visible of sprite(param(i)) to true
  137.     else
  138.       listePistes1 param(i),1
  139.     end if
  140.   end repeat
  141. end afficherPistes
  142.  
  143. -- pistes esclaves
  144. on spritesOn
  145.   repeat with i=1 to the paramCount
  146.     if value(param(i))<>0 then
  147.       puppetSprite (param(i)), true
  148.     else
  149.       listePistes2 param(i),1
  150.     end if
  151.   end repeat
  152. end sprites On
  153.  
  154. on spritesOff
  155.   repeat with i=1 to the paramCount
  156.     if value(param(i))<>0 then
  157.       puppetSprite (param(i)), false
  158.     else
  159.       listePistes2 param(i),0
  160.     end if
  161.   end repeat
  162. end sprites Off
  163.  
  164. -- gestion d'une liste de pistes du type "[premiΦre piste]>[derniΦre piste]"
  165.  
  166. --> pour affichage pistes
  167. on listePistes1 chaine,v
  168.   set n=offset(">", chaine)
  169.   set n1=value(char 1 to n-1 of chaine)
  170.   set n2=value(char n+1 to length(chaine) of chaine)
  171.   repeat with j=n1 to n2
  172.     set the visible of sprite j to v
  173.   end repeat
  174. end listePistes1
  175.  
  176. --> pour pistes sprites
  177. on listePistes2 chaine,v
  178.   set n=offset(">", chaine)
  179.   set n1=value(char 1 to n-1 of chaine)
  180.   set n2=value(char n+1 to length(chaine) of chaine)
  181.   repeat with j=n1 to n2
  182.     puppetSprite j,v
  183.   end repeat
  184. end listePistes2
  185.  
  186. -- rend visibles toutes les pistes
  187. on allVisible
  188.   repeat with i=1 to 120
  189.     afficherPistes i
  190.   end repeat
  191. end
  192.  
  193.